package com.mowuju.data.jike.rpc;

import org.apache.hadoop.ipc.ProtocolSignature;

import java.io.IOException;

/**
 * @author liumo yangqiuhua@xincheng818.com
 * @project: mapreduce
 * @description:
 * @date 2021/7/25
 */
public class PersonProtocolImpl implements PersonProtocol {
    /**
     * Return protocol version corresponding to protocol interface.
     *
     * @param protocol      The classname of the protocol interface
     * @param clientVersion The version of the protocol that the client speaks
     *
     * @return the version that the server will speak
     *
     * @throws IOException if any IO error occurs
     */
    @Override
    public long getProtocolVersion(String protocol, long clientVersion) throws IOException {
        return versionId;
    }

    /**
     * Return protocol version corresponding to protocol interface.
     *
     * @param protocol          The classname of the protocol interface
     * @param clientVersion     The version of the protocol that the client speaks
     * @param clientMethodsHash the hashcode of client protocol methods
     *
     * @return the server protocol signature containing its version and
     * a list of its supported methods
     *
     * @see ProtocolSignature#getProtocolSignature(VersionedProtocol, String, * long, int) for a default implementation
     */
    @Override
    public ProtocolSignature getProtocolSignature(String protocol, long clientVersion, int clientMethodsHash) throws IOException {
        return null;
    }

    /**
     * @param studentId
     *
     * @return
     */
    @Override
    public String findName(long studentId) {
        if (20210123456789L == studentId) {
            return "心心";
        }

        return null;
    }
}
